# -*- coding: utf-8 -*-
# author: sixmillions
# date: 2022/4/6


import pandas as pd
from pandas import DataFrame

# import webbrowser
# link = 'https://gitee.com/sixmillions/python-learn/tree/master/pandas_demo/tiobe-202203.md'
# webbrowser.open(link)

'''
Mar 2022	Mar 2021	Programming Language	Ratings	Change
1	3	Python	14.26%	+3.95%
2	1	C	13.06%	-2.27%
3	2	Java	11.19%	+0.74%
4	4	C++	8.66%	+2.14%
5	5	C#	5.92%	+0.95%
6	6	Visual Basic	5.77%	+0.91%
7	7	JavaScript	2.09%	-0.03%
8	8	PHP	1.92%	-0.15%
9	9	Assembly language	1.90%	-0.07%
10	10	SQL	1.85%	-0.02%
11	13	R	1.37%	+0.12%
12	14	Delphi/Object Pascal	1.12%	-0.07%
13	11	Go	0.98%	-0.33%
14	19	Swift	0.90%	-0.05%
15	18	MATLAB	0.80%	-0.23%
16	16	Ruby	0.66%	-0.52%
17	12	Classic Visual Basic	0.60%	-0.66%
18	20	Objective-C	0.59%	-0.31%
19	17	Perl	0.57%	-0.58%
20	38	Lua	0.56%	+0.23%
'''

# 从打开的网站复制一下, 或者复制上面的注释
df = pd.read_clipboard()
print(df)
print("类型：", type(df))
print('列名:', df.columns)
print("具体列（Ratins列）：\n", df.Ratings)
print("具体列（Programming Language列）：\n", df['Programming Language'])
# 某几列
df_new = DataFrame(df, columns=['Programming Language', 'Ratings'])
print("具体某几列：\n", df_new)
# 获取出来的某一列就是一个Series
print("单列的类型：", type(df['Programming Language']))  # 单列的类型： <class 'pandas.core.series.Series'>
